﻿@page
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Mvc.Localization
@using ProductManagement
@using ProductManagement.Localization
@model ProductManagement.Pages.ProductManagement.Products.IndexModel
@using Volo.Abp.AspNetCore.Mvc.UI.Theming
@inject IThemeManager ThemeManager
@inject IAuthorizationService Authorization
@inject IHtmlLocalizer<ProductManagementResource> L
@{
    ViewBag.PageTitle = "Products";
    Layout = ThemeManager.CurrentTheme.GetApplicationLayout();
}

@section scripts {
    <abp-script src="/Pages/ProductManagement/Products/index.js" />
}

<abp-card>
    <abp-card-header>
        <abp-row>
            <abp-column size-md="_6">
                <h2>@L["Products"]</h2>
            </abp-column>
            <abp-column size-md="_6" class="text-right">
                @if (await Authorization.IsGrantedAsync(ProductManagementPermissions.Products.Create))
                {
                    <abp-button icon="plus" text="@L["CreateANewProduct"].Value" button-type="Primary" id="CreateNewProductButtonId"></abp-button>
                }
            </abp-column>
        </abp-row>
    </abp-card-header>
    <abp-card-body>
        <abp-table striped-rows="true" id="ProductsTable" class="nowrap">
            <thead>
                <tr>
                    <th>@L["Actions"]</th>
                    <th>@L["Code"]</th>
                    <th>@L["Name"]</th>
                    <th>@L["Price"]</th>
                    <th>@L["StockCount"]</th>
                </tr>
            </thead>
        </abp-table>
    </abp-card-body>
</abp-card>
